package Java攻略._2_java_util_function包._3_Predicate接口;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class _7_查找具体给定长度的字符串 {

    public static void main(String[] args) {

        _7_查找具体给定长度的字符串 _7 = new _7_查找具体给定长度的字符串();
        String namesOfLength = _7.getNamesOfLength(3, "3","123", "345", "567","43242334");
        System.out.println(namesOfLength);
    }

    public String getNamesOfLength(int length, String... names){
        return Arrays.stream(names)
                .filter(s -> s.length() == length)
                .collect(Collectors.joining(", "));
    }
}
